The present invention relates to a method of compensating the edge positions of a signal generated by scanning a bar code.
As is known, bar codes (FIG. 1b) are optical codes containing coded information defined by a number of dark-coloured (normally black) rectangular elements (bars) separated by light-coloured (normally white) elements (spaces).
Devices for reading such codes normally comprise a lighting device (e.g. a laser beam source, a linear array of LEDs, etc.) for directing light on to the bar code and a sensor (e.g. a photodiode, a linear array of photodetectors or a television camera) for receiving part of the light diffused by the support on which the bar code is impressed. In response to the light impinging on it, the sensor produces an alternating electric output signal, the waveform of which is modulated by the sequence of light/dark bar code elements. As is known, light is absorbed by the bars and reflected by the spaces, so that the signal assumes a high value (peak) corresponding to a space, on account of the high radiation impinging on the sensor, and a low value (valley) corresponding to a bar, on account of the low radiation impinging on the sensor. The signal generated by scanning the bar code therefore has a typical alternating pattern comprising a sequence of peaks and valleys, each peak corresponding to a space, and each valley to a bar.
The region between a peak and two adjacent valleys represents the width of a space and the region between a valley and two adjacent peaks the width of a bar. FIG. 4, for example, shows the waveform of a bar code scanned in ideal conditions (perfectly focused signal with no noise).
Currently used readers examine the above waveform to determine the positions of edges F of the waveform, i.e. the steeply sloping waveform portions between the peaks and valleys and vice versa; each of which edges corresponds to the edge between two different-coloured bar code elements (space and bar and vice versa). The position of the edges is used to calculate the dimensions of the bar code elements and so permit subsequent decoding.
As is known, the alternating signal is subject to severe deformation due to a number of factors, including:
Code blurring B. This is defined mathematically as the ratio between the standard deviation std of the function describing the spatial energy dispersion of the laser beam (spot) lighting the optical code and the dimension W of the narrowest code element, i.e. B=std/W. Blurring therefore increases with energy dispersion of the laser beam about the mean value, i.e. enlargement of the laser beam spot, and with the reduction in the dimensions of the bar code and seriously affects the waveform of the alternating signal by lowering the peaks representing the narrower spaces and raising the valleys representing the narrower bars of the code. Above a given blur value, even sequences of narrow elements between two wide elements are absorbed by the wide elements to produce only one edge and odd sequences of narrow elements between two wide elements merge to form one element. PA1 Electrooptical acquisition system. Electrooptical acquisition systems are known to act as "low-pass" filters, which tend to eliminate the higher space frequencies of the scanned bar code signal. As long as the space frequencies of the code correspond to the pass-band operating region of the electrooptical device, deformation of the signal is negligible and the resulting measurements accurate. Conversely, when the reading device operates outside the pass band (because of a reduction in the print size of the code or because the code is outside the focus position of the electrooptical acquisition device), distortion of the analog signal is no longer negligible. PA1 if the two adjacent elements (bar and space) are the same size (i.e. the same width), the corresponding peak and valley are shifted, with respect to the mean value of the signal, by substantially constant amounts (i.e. the amplitude of the peak is reduced by an amount substantially equal to the reduction in depth of the valley) so that the position of the edge is not seriously affected (curve A in FIG. 5); and PA1 if the two adjacent elements (bar and space) are of different sizes (different widths), the corresponding peak and valley are shifted differently with respect to the mean value of the signal, in the sense that the amplitude of the peak or valley corresponding to the narrower element is reduced to a greater extent than the peak or valley corresponding to the wider element, so that the position of the edge is seriously affected (curve B in FIG. 5).
The above factors combine to seriously deform the waveform. One consequence of deformation is a shift in the edges, which assume positions, within the waveform, other than those which they would have in the absence of deformation.
More specifically, considering pairs of adjacent code elements (bar-space or space-bar), the extent to which blurring affects the edge positions (FIG. 5) varies according to the dimensions of the adjacent code elements, in the sense that:
In other words, blurring has the effect of "attracting" the edges towards the wider adjacent code elements.
The edge shift caused by the above factors (blurring and noise) therefore alters the width relationship between the code elements (bars and spaces), with obvious consequences as regards decoding of the code.